---
title: Google BigQuery Tools
---

## Code

```python cookbook/tools/google_bigquery_tools.py
from agno.agent import Agent
from agno.tools.google_bigquery import GoogleBigQueryTools

agent = Agent(
    instructions=[
        "You are a data analyst assistant that helps with BigQuery operations",
        "Execute SQL queries to analyze large datasets",
        "Provide insights and summaries of query results",
    ],
    tools=[GoogleBigQueryTools(dataset="your_dataset_name")],
    markdown=True,
)

agent.print_response("List all tables in the dataset and describe the sales table")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your credentials">
    ```bash
    export GOOGLE_CLOUD_PROJECT=your-project-id
    export GOOGLE_CLOUD_LOCATION=US
    export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash
    pip install -U google-cloud-bigquery openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python cookbook/tools/google_bigquery_tools.py
    ```

    ```bash Windows
    python cookbook/tools/google_bigquery_tools.py
    ```
    </CodeGroup>
  </Step>
</Steps>
